package eleven.test_11_21;

import java.util.Scanner;

public class TestMain2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        int count = 0;
        for(int start = 0; start < str.length(); start++){
            for(int end = start; end < str.length(); end++) {
                String substring = str.substring(start, end + 1);
                if(substring.contains("r") && substring.contains("e") && !substring.contains("d")) {
                    count++;
                }
            }
        }
        System.out.println(count);
    }
}
